
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:im_base/public/global/global.dart';

import 'logic.dart';

class AudioOverlay extends StatelessWidget {
  final String? id;
  AudioOverlay(this.id);
  @override
  Widget build(BuildContext context) {
    return GetBuilder<InputLogic>(
      init: Get.find<InputLogic>(tag: id),
      tag: id,
        id: AUDIO_OVERLAY,
        builder: (logic) {
          return logic.state.showAudioOverlay
              ? Opacity(
                  opacity: 0.8,
                  child: Container(
                    width: 160,
                    height: 160,
                    decoration: BoxDecoration(
                        color: Color(0xff77797A),
                        borderRadius: BorderRadius.circular(16)),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Container(
                          width: 85,
                          height: 85,
                          child: logic.state.cancelAudio
                              ? Image.asset(
                                  '${Global.IMAGE_PATH}ic_volume_cancel.png')
                              : Image.asset(
                                  '${Global.IMAGE_PATH}${logic.state.voiceIndicator}',
                                ),
                        ),
                        Text(
                          logic.state.audioNotify,
                          style: TextStyle(color: Colors.white,fontSize: 14),
                        )
                      ],
                    ),
                  ),
                )
              : Container();
        });
  }
}
